<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
  </head>
  <body>
    <script>
      const _flatten = (arr) => {
        // 补全代码
        return arr
          .toString()
          .split(',')
          .map((item) => Number(item))
      }
      console.log(_flatten([1, [2, [3, [4]]]]))
    </script>
  </body>
</html>
